package com.jrsa.augmented_reality.Sun;

//Helpers to determine Direction from degree.  Assumes North is at 0 degrees
class DirCalc
{
    final static float ADJUSTMENT = 22.5f;

    static String getDirection(float degree)
    {
        String dir = "";
        if((degree >= 0.0 && degree < 0.0 + ADJUSTMENT) || (degree >= 360.0 - ADJUSTMENT))
        {
            dir += "N";
        }
        else if(degree >= 45.0 - ADJUSTMENT && degree < 45.0 + ADJUSTMENT)
        {
            dir += "NE";
        }
        else if(degree >= 90.0 - ADJUSTMENT && degree < 90.0 + ADJUSTMENT)
        {
            dir += "E";
        }
        else if(degree >= 135.0 - ADJUSTMENT && degree < 135.0 + ADJUSTMENT)
        {
            dir += "SE";
        }
        else if(degree >= 180.0 - ADJUSTMENT && degree < 180.0 + ADJUSTMENT)
        {
            dir += "S";
        }
        else if(degree >= 225.0 - ADJUSTMENT && degree < 225.0 + ADJUSTMENT)
        {
            dir += "SW";
        }
        else if(degree >= 270.0 - ADJUSTMENT && degree < 270.0 + ADJUSTMENT)
        {
            dir += "W";
        }
        else if(degree >= 315.0 - ADJUSTMENT && degree < 315.0 + ADJUSTMENT)
        {
            dir += "NW";
        }
        return dir;
    }
}